package com.peenongsaban.freelance.action;

import com.opensymphony.xwork2.ActionSupport;
import com.peenongsaban.freelance.bean.RegisterBean;
import com.peenongsaban.freelance.model.MyServiceModel;
import com.peenongsaban.freelance.service.MyServiceService;
import com.peenongsaban.freelance.utils.ConstantUtils;
import com.peenongsaban.freelance.utils.SessionUtils;

public class MyServiceAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private MyServiceModel model = new MyServiceModel();

	public String myService() {
		MyServiceService service = new MyServiceService();
		RegisterBean bean = (RegisterBean) SessionUtils.getSession(ConstantUtils.SESSION_LOGIN);
		if(bean==null){
			bean = new RegisterBean();
		}
		model.setListMyPostService(service.getListMyPostService(model));
		model.setListMyRequestService(service.getListMyRequestService(model));
		model.setPagePostService(service.pagingPostService(model));
		model.setPageRequestService(service.pagingRequstService(model));
		model.setListLastService(service.getListLastPostService());
		model.setAllMyPostService(service.allMyPostService(bean.getUser().getIdCard()));
		model.setAllMyRequestService(service.allMyRequestService(bean.getUser().getIdCard()));
		return SUCCESS;
	}

	public MyServiceModel getModel() {
		return model;
	}

	public void setModel(MyServiceModel model) {
		this.model = model;
	}

}
